﻿// Copyright (c)  YISH. All rights reserved.
// Licensed under the MIT License, See License.txt in the project root for license information.

using System.Collections.Generic;
using System.Linq;
using NSQL.Expressions;
using NSQL.Sharpen;

namespace NSQL.Statements
{
    public class GroupCollection : ElementCollection<IExpression, ColumnExpression>, IDeepClone
    {
        public GroupCollection(IEnumerable<IExpression> elements) : base(elements)
        {
        }
        
        public GroupCollection()
        {
        }
        
        public IPredicateExpression Having { get; set; }

        object IDeepClone.DeepCopy()
        {
            return new GroupCollection(this.Select(o => o.DeepClone()))
            {
                Having = Having.DeepClone()
            };
        }
    }
}